package mrusanov.view

import java.awt.{Point, Graphics2D, Graphics}

trait GraphicEffect {
  def update(time:Int)

  def render(g:Graphics2D)

  def over:Boolean

  def reset()

  def initEffect(playerPosition:Point, enemyPosition:Point)
}

object GraphicEffect {
  def apply(name:String, success:Boolean, up:Boolean):GraphicEffect = {
    val newName = if (success) name + "-succ"
                  else name + "-fail"
    val info = GraphicEffectInfoLoader.effectsInfo(newName)
    new MovingSpriteEffect(info.images(up), info.distance, info.moveEndSound)
  }
}
